#include "UltimateAsioNetworkSubsystem.h"

int main()
{

	UltimateAsioNetworkSubsystem networkSubsystem;

	networkSubsystem.createRecordForPlayer(1);
	networkSubsystem.createRecordForPlayer(2);
	networkSubsystem.createRecordForPlayer(3);

	networkSubsystem.listenOnPort(11180);

	float i =0;

	

	while(1)
	{
	   UltimateNetworkSubsystem::EntityNetworkRecord record=  networkSubsystem.getRecordForPlayer(3);
	   UltimateNetworkSubsystem::EntityNetworkRecord recordOwn=  networkSubsystem.getRecordForPlayer(1);

	   if(record.entitySpotStatus!=UltimateNetworkSubsystem::FREE)
	   {

	   UltimateNetworkSubsystem::EntityNetworkRecord newEntityRecord;
		newEntityRecord.id = 1;
		newEntityRecord.position= record.position+ Ogre::Vector3(0,30*cos(i),30);
		newEntityRecord.orientation= record.orientation;
		newEntityRecord.entitySpotStatus=recordOwn.entitySpotStatus;
		newEntityRecord.entityNetworkStatus = UltimateNetworkSubsystem::PLAYING;
		networkSubsystem.setRecordForPlayer(1, newEntityRecord);

		i+=0.00001;

		if(i==100)
		{
			i=0;
		}
	   }

	  /* printf("\npostition: %f,%f,%f", record.position.x,record.position.y,record.position.z);
	   system("cls");*/
	}

}